Skip to content

Callback-based zoom/offset workaround for Avalonia PanAndZoom#4

Merged
JohnnyJF10 merged 3 commits intodevelopfrom
copilot/implement-zoom-offset-workaround
Apr 14, 2026
Merged

Callback-based zoom/offset workaround for Avalonia PanAndZoom#4
JohnnyJF10 merged 3 commits intodevelopfrom
copilot/implement-zoom-offset-workaround

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 12, 2026

  • 1. Create IViewTabViewModel interface in TgaBuilderLib/Abstraction/ with common properties/commands
  • 2. Create WritableViewTabViewModel (for WPF) - extracted from old ViewTabViewModel, handles writable zoom and offsets via property bindings
  • 3. Create ReadOnlyViewTabViewModel (for Avalonia) - uses matrix transformation callbacks, includes ZoomIn/ZoomOut/ResetView callbacks
  • 4. Update MainViewModel to use IViewTabViewModel instead of ViewTabViewModel
  • 5. Update WPF DI to register WritableViewTabViewModel as IViewTabViewModel
  • 6. Update Avalonia DI to register ReadOnlyViewTabViewModel as IViewTabViewModel
  • 7. Update Avalonia MainWindow to use ReadOnlyViewTabViewModel for callback registration
  • 8. Remove old ViewTabViewModel class
  • 9. Fix ScrollViewer reset issue - Remove ScrollViewer wrapping ZoomBorder in Avalonia (PanAndZoom has its own pan/zoom; ScrollViewer conflicts with matrix transformations and causes wrong scroll ranges on content reset). Added ResetViewCallback that calls panel.ResetMatrix() before reapplying zoom on content changes.
  • 10. Replace zoom sliders with zoom in/out buttons in Avalonia UI - added ZoomInCommand/ZoomOutCommand with step factor to ReadOnlyViewTabViewModel, replaced Slider controls with IconButton controls in XAML for both source and destination panels
  • 11. Build all projects - TgaBuilderLib, TgaBuilderAvaloniaUi, TgaBuilderWpfUi all build successfully
  • 12. Run parallel validation - CodeQL clean, code review found only pre-existing style issues

…backs

- Add readOnlyZoomAndOffsets parameter to ViewTabViewModel constructor (default false)
- Add ApplyTransformCallback and PanStepCallback callback properties
- Modify Fill, Fit, Zoom100, DefferedFill to use callbacks in read-only mode
- Modify StartScrollingAsync to use step-per-second translation via callback
- Pass readOnlyZoomAndOffsets=true in Avalonia DI registration
- Remove PanelAttributesAP bindings from Avalonia ZoomBorder XAML
- Register ZoomBorder matrix callbacks in MainWindow.Methods.axaml.cs
- WPF version remains completely unaffected

Agent-Logs-Url: https://github.com/JohnnyJF10/TgaBuilder/sessions/dd11e2f8-35b2-4466-9eed-5693e68e6e9b

Co-authored-by: JohnnyJF10 <83164789+JohnnyJF10@users.noreply.github.com>
…bleViewTabViewModel (WPF) and ReadOnlyViewTabViewModel (Avalonia) implementations. Remove ScrollViewer wrapping ZoomBorder in Avalonia. Replace zoom sliders with zoom in/out buttons in Avalonia.

Agent-Logs-Url: https://github.com/JohnnyJF10/TgaBuilder/sessions/8054e0dc-5318-4ad0-a950-15115fde15af

Co-authored-by: JohnnyJF10 <83164789+JohnnyJF10@users.noreply.github.com>
Copilot AI requested a review from JohnnyJF10 April 14, 2026 16:17
@JohnnyJF10 JohnnyJF10 marked this pull request as ready for review April 14, 2026 16:22
@JohnnyJF10
Copy link
Copy Markdown
Owner

@copilot resolve the merge conflicts in this pull request

…zoom-offset-workaround

Co-authored-by: JohnnyJF10 <83164789+JohnnyJF10@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 14, 2026

@copilot resolve the merge conflicts in this pull request

Resolved in 8150525. The merge from origin/develop was auto-resolved by git — no manual conflict resolution needed. All three projects (TgaBuilderLib, TgaBuilderAvaloniaUi, TgaBuilderWpfUi) build with 0 errors.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • av-build-tel-api-v1.avaloniaui.net
    • Triggering command: /usr/share/dotnet/dotnet dotnet exec --runtimeconfig /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.1/tools/netstandard2.0/runtimeconfig.json /home/REDACTED/.nuget/packages/avalonia.buildservices/11.3.1/tools/netstandard2.0/Avalonia.BuildServices.Collector.dll (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@JohnnyJF10 JohnnyJF10 merged commit 532514c into develop Apr 14, 2026
@JohnnyJF10 JohnnyJF10 deleted the copilot/implement-zoom-offset-workaround branch April 14, 2026 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants